﻿using System.Web.Security;

namespace GiveAQuiz.Web.Authentication
{
  /// <summary>
  /// This class implements the IFormsAuthentication interface 
  /// by wrapping calls to FormsAuthentication.
  /// </summary>
  public class FormsAuthenticationService : IFormsAuthentication
  {
    /// <summary>
    /// Sign in to the application using forms authentication.
    /// </summary>
    /// <param name="userName">The user name.</param>
    /// <param name="createPersistentCookie">Remember me? option on 
    /// a web application.</param>
    public void SignIn(string userName, bool createPersistentCookie)
    {
      FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
    }

    /// <summary>
    /// Sign out of the application using forms authentication.
    /// </summary>
    public void SignOut()
    {
      FormsAuthentication.SignOut();
    }
  }
}